package com.wutuo.aggragation.report.controller;

import cn.apestar.agg.common.security.BaseAuthController;
import com.wutuo.aggragation.report.response.ListMonthSignDataItem;
import com.wutuo.aggragation.report.response.ListMonthTaskDataItem;
import com.wutuo.aggragation.report.response.ListMonthTaskDetailItem;
import com.wutuo.aggragation.report.service.SignReportService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * 标题、简要说明. <br> 类详细说明.
 * <p/>
 * Copyright: Copyright (c) 2016年4月23日 上午7:47:40
 * <p/>
 *
 * @author Shunqin.Chen
 * @version 1.0.0
 */
@RestController
@RequestMapping(value = "/report/sign")
public class SignReportController extends BaseAuthController {

    private Logger logger = LoggerFactory.getLogger(SignReportController.class);

    @Autowired
    SignReportService signReportService;

    @RequestMapping(value = "/list", method = RequestMethod.GET)
    public List<ListMonthSignDataItem> listMonthSignData(@RequestParam(value = "page", defaultValue = "1") int page,
                                                         @RequestParam(value = "size", defaultValue = "10") int size) {
        return signReportService.listMonthSignData(page, size, getInstitutionId());
    }

    @RequestMapping(value = "/month/{month}/type/{type}", method = RequestMethod.GET)
    public List<ListMonthTaskDataItem> listMonthTaskDataDetail(@PathVariable("month") String month,
                                                               @PathVariable("type") String type) {
        return signReportService.listMonthTaskDataDetail(month, type, getInstitutionId());
    }

    @RequestMapping(value = "/month/{month}/type/{type}/child/{child_id}", method = RequestMethod.GET)
    public List<ListMonthTaskDetailItem> listMonthTaskSignRecord(@PathVariable("month") String month,
                                                                 @PathVariable("type") String type, @PathVariable("child_id") Long childId) {
        return signReportService.listMonthTaskSignRecord(month, type, getInstitutionId(), childId);
    }
}
